package com.gyhy.dumplings.order.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @description:
 * @author: 光影灰翼
 * @date: 2022-09-25 10:18
 * @version: 1.0
 * @email: 978330688@qq.com
 */
@Configuration
public class DumplingsWebConfig implements WebMvcConfigurer {

    @Bean
    public JWTInterceptor jwtInterceptor(){
        return new JWTInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtInterceptor())//注册拦截器
                .addPathPatterns("/**");
    }

}
